8027be84: 27 bd ff e0  ADDIU sp, sp, 0xffffffe0 (-32)
8027be88: af bf 00 14  SW ra, sp, 0x14 (20)
8027be8c: af a4 00 20  SW a0, sp, 0x20 (32)                    [sp + 0x20] === arg1

8027be90: 8f ae 00 20  LW t6, sp, 0x20 (32)
8027be94: 8d cf 00 10  LW t7, t6, 0x10 (16)
8027be98: af af 00 1c  SW t7, sp, 0x1c (28)                [sp + 0x1c] = arg1->off0x10; /* child */

8027be9c: 8f b8 00 20  LW t8, sp, 0x20 (32)
8027bea0: 8f 19 00 14  LW t9, t8, 0x14 (20)
8027bea4: 13 20 00 0c  BEQ r0, t9, 0x8027bed8 (pc + 0x30)  if (!arg1->off0x14) goto 0x8027bed8;
8027bea8: 00 00 00 00  NOP

8027beac: 8f a8 00 20  LW t0, sp, 0x20 (32)
8027beb0: 3c 09 80 34  LUI t1, 0x8034 (32820)
8027beb4: 85 29 ba e0  LH t1, t1, 0xffffbae0 (-17696)
8027beb8: 8d 19 00 14  LW t9, t0, 0x14 (20)
8027bebc: 3c 0b 80 34  LUI t3, 0x8034 (32820)
8027bec0: 25 6b ba e8  ADDIU t3, t3, 0xffffbae8 (-17688)
8027bec4: 00 09 51 80  SLL t2, t1, 0x6 (6)
8027bec8: 01 4b 30 21  ADDU a2, t2, t3
8027becc: 24 04 00 01  ADDIU a0, r0, 0x1 (1)
8027bed0: 03 20 f8 09  JALR t9, ra                         (arg1->off0x14)(1, arg1, &(cpu_mtx_stack[cpu_mtx_idx])); /////  ((*(0x8033bae0))*64) + 0x8033bae8)
8027bed4: 01 00 28 25  OR a1, t0, r0

*
8027bed8: 8f ac 00 1c  LW t4, sp, 0x1c (28)
8027bedc: af a0 00 18  SW r0, sp, 0x18 (24)                [sp + 0x18] = 0;
8027bee0: 11 80 00 12  BEQ r0, t4, 0x8027bf2c (pc + 0x48)  if (![sp + 0x1c]) goto 0x8027bf2c;
8027bee4: 00 00 00 00  NOP

8027bee8: 8f ad 00 20  LW t5, sp, 0x20 (32)
8027beec: 85 ae 00 1e  LH t6, t5, 0x1e (30)
8027bef0: 19 c0 00 0e  BLEZ t6, 0x8027bf2c (pc + 0x38)     if (arg1->off0x1e <= 0) 0x8027bf2c;
8027bef4: 00 00 00 00  NOP

*
8027bef8: 8f af 00 1c  LW t7, sp, 0x1c (28)
8027befc: 8d f8 00 08  LW t8, t7, 0x8 (8)
8027bf00: af b8 00 1c  SW t8, sp, 0x1c (28)                [sp + 0x1c] = [sp + 0x1c]->off0x08;

8027bf04: 8f a9 00 18  LW t1, sp, 0x18 (24)
8027bf08: 8f ab 00 1c  LW t3, sp, 0x1c (28)
8027bf0c: 25 2a 00 01  ADDIU t2, t1, 0x1 (1)               [sp + 0x18]++;
8027bf10: 11 60 00 06  BEQ r0, t3, 0x8027bf2c (pc + 0x18)  if (![sp + 0x1c]) goto 0x8027bf2c;
8027bf14: af aa 00 18  SW t2, sp, 0x18 (24)

8027bf18: 8f a8 00 20  LW t0, sp, 0x20 (32)
8027bf1c: 85 19 00 1e  LH t9, t0, 0x1e (30)
8027bf20: 01 59 08 2a  SLT at, t2, t9
8027bf24: 14 20 ff f4  BNE at, r0, 0x8027bef8 (pc - 0x30)  if ([sp + 0x18] < arg1->off0x1e) goto 0x8027bef8;
8027bf28: 00 00 00 00  NOP

***
8027bf2c: 8f ac 00 1c  LW t4, sp, 0x1c (28)
8027bf30: 11 80 00 03  BEQ r0, t4, 0x8027bf40 (pc + 0xc)   if (![sp + 0x1c]) goto 0x8027bf40;
8027bf34: 00 00 00 00  NOP

8027bf38: 0c 09 f7 aa  JAL 0x8027dea8 (-2144870744)        0x8027dea8([sp + 0x1c]);
8027bf3c: 8f a4 00 1c  LW a0, sp, 0x1c (28)

*
8027bf40: 10 00 00 01  BEQ r0, r0, 0x8027bf48 (pc + 0x4)
8027bf44: 00 00 00 00  NOP
8027bf48: 8f bf 00 14  LW ra, sp, 0x14 (20)
8027bf4c: 27 bd 00 20  ADDIU sp, sp, 0x20 (32)
8027bf50: 03 e0 00 08  JR ra
8027bf54: 00 00 00 00  NOP

{
    [sp + 0x1c] = arg1->off0x10; /* child */
    
    if (arg1->off0x14) {
        (arg1->off0x14)(1, arg1, &(cpu_mtx_stack[cpu_mtx_idx])); /////  ((*(0x8033bae0))*64) + 0x8033bae8)
    }
    
    [sp + 0x18] = 0;
    while ([sp + 0x1c] && arg1->off0x1e > [sp + 0x18]++) {
        [sp + 0x1c] = [sp + 0x1c]->off0x08;
    }
    
    if ([sp + 0x1c]) {
        0x8027dea8([sp + 0x1c]);
    }
}

void proc_0x8027be84(LAYOUT_NODE_0x10C *node)
{
    int i;
    LAYOUT_NODE *p;
    
    p = node->child; /* child */
    
    if (node->func) {
        (node->func)(1, node, &(cpu_mtx_stack[cpu_mtx_idx])); /////  ((*(0x8033bae0))*64) + 0x8033bae8)
    }
    
    i = 0;
    while (p && ++i < node->chosen_child) {
        p = p->next;
    }
    
    if (p) {
        0x8027dea8(p);
    }
}
